import {createService } from "../request"
const rq = createService('/myapi')

// 获得图片分类列表，带分页 注意为了统一格式，分页必须采用page, params, config这样的定义格式
export function getRuleList(page, params, config) {
    return rq.get(
      `/admin/rule/${page}`,
      params,
      config
    )
}

// 获取权限树
export function getRuleTree(params, config) {
  return rq.get(
    `/admin/rule/tree`,
    params,
    config
  )
}

// 新增菜单
export function addRule(form, config) {
  return rq.post(`admin/rule`, form, config)
}

// 修改菜单
export function updateRuleById(form, config) {
  delete form.child
  return rq.post(`/admin/rule/${form.id}`,form, config)
}


// 删除菜单
export function deleteRuleById(id, config) {
  return rq.post(`/admin/rule/${id}/delete`, null, config)
}


// 修改管理员状态
export function UpateRuleStatusById(id, status, config) {
  return rq.post(`/admin/rule/${id}/update_status`, {status}, config)
}